package concept.misc;

class Top
{
	int i = 2;
	int getInt()
	{
		return i;
	}
}

class Middle extends Top
{
	int i = 1;
}

class Bottom extends Middle
{
	int i = 0;
	int getInt()
	{
		return i;
	}
}

class NumberTest
{
	void doNumber(int i)
	{
		System.out.println("int");
	}
	void doNumber(Object o)
	{
		System.out.println("Object");
	}
	void doNumber(double d)
	{
		System.out.println("double");
	}
	void doNumber(short d)
	{
		System.out.println("short");
	}
}
public class PolymorphismLab
{
	static void testInstanceOverriden()
	{
		Top t = new Top();
		Top m = new Middle();
		Middle b = new Bottom();
		Top tt = (Top)b;
		
		System.out.println("t.i = "+t.i);
		System.out.println("m.i = "+m.i);
		System.out.println("b.i = "+b.i);
		System.out.println("tt.i = "+tt.i);
	}
	static void doOverload()
	{
		NumberTest nt = new NumberTest();
		nt.doNumber(1);
		nt.doNumber(1f);
		nt.doNumber(1l);
		nt.doNumber(new Integer(1));
	}
	public static void main(String[] args)
	{
		testInstanceOverriden();
		doOverload();
	}

}
